---
id: 658238f7604f154ea9a23e1e
title: ステップ 14
challengeType: 20
dashedName: step-14
---

# --description--

The `sum()` function returns the sum of the items in the iterable which is passed as its argument. You are going to use `sum()` together with `map()` and `lambda` functions to get the total amount of expenses.

For now, make a little test and modify your current `print()` call by passing `sum(map(test, [2, 3, 5, 8]))` as the argument.

# --hints--

You should print `sum(map(test, [2, 3, 5, 8]))`.

```js
({ test: () => assert.match(code, /^print\s*\(\s*sum\s*\(\s*map\s*\(\s*test\s*,\s*\[\s*2\s*,\s*3\s*,\s*5\s*,\s*8\s*\]\s*\)\s*\)\s*\)/m) })
```

# --seed--

## --seed-contents--

```py
def add_expense(expenses, amount, category):
    expenses.append({'amount': amount, 'category': category})

def print_expenses(expenses):
    for expense in expenses:
        print(f'Amount: {expense["amount"]}, Category: {expense["category"]}')

def total_expenses(expenses):
    pass

--fcc-editable-region--
test = lambda x: x * 2
print(map(test, [2, 3, 5, 8]))
--fcc-editable-region--

expenses = []
```
